package com.li.day.day17;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class Hllo extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setCharacterEncoding("gbk");
        resp.setContentType("text/html;charset=utf-8");
        String name = new String(req.getParameter("name").getBytes("iso-8859-1"),"utf-8");
        PrintWriter wr = resp.getWriter();
        wr.write("欢迎您"+name);
        wr.write("&emsp;&emsp;&emsp;&emsp;请稍后...............");
        resp.setHeader("Refresh","5;URL=a.html");
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doPost(req,resp);
    }
}
